//
//  Tree.h
//  AlgorithmLearning
//
//  Created by aron on 2017/11/9.
//  Copyright © 2017年 aron. All rights reserved.
//

#ifndef Tree_h
#define Tree_h

#include <stdio.h>

typedef int16_t ElementType;

struct TreeNode;
typedef struct TreeNode *Position;
typedef struct TreeNode *SearchTree;

struct TreeNode {
    ElementType Element;
    int Count;
    SearchTree Left;
    SearchTree Right;
};


SearchTree Tree_MakeEmpty(SearchTree T);
// 查找
Position Tree_Find(ElementType Element, SearchTree T);
Position Tree_FindMax(SearchTree T);
Position Tree_FindMin(SearchTree T);
SearchTree Tree_Insert(ElementType Element, SearchTree T);
// 删除
SearchTree Tree_Delete(ElementType Element, SearchTree T);
// 删除
SearchTree Tree_Delete2(ElementType Element, SearchTree T);
// Left->Middle->Right 中序遍历
void Tree_LMR_Travel(SearchTree T);

#endif /* Tree_h */
